/**
 * Created by Administrator on 2016/7/2.
 */

$("document").ready(function(){
    $("section button").click(function(){
        var session_id = sessionStorage.session_id;
        var user_token =  sessionStorage.user_token;
        var old_password = $("section input:first-child").val();
        var new_password = $("section input:nth-child(2)").val();
        $.post(commonval+"/updatePassWord",{
            u_id:u_id,
            user_token:user_token,
            device:"wap",
            old_password:old_password,
            new_password:new_password,
            session_id:session_id
        },function(data){
            if (data.status == 1) {
                createWindow("修改密码成功");
                location.href ='changeInfo.html';
            } else if (data.status == 0) {
                createWindow(data.msg);
            }
            function createWindow(msg) {
                var window =$("<section class='showMsg'></section>");
                var show = "<p>"+msg+"</p>";
                window.append(show);
                $("body").append(window);
                setTimeout("$('.showMsg').remove()",3000);
            }

        });
    });
});